﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.datatype;

namespace ExtendedWorkFlow.DataTypes
{
    
    public class ExtendedWorkFlowGroupDocumentTypesDataType : umbraco.cms.businesslogic.datatype.AbstractDataEditor
    {

        #region Variables

        ExtendedWorkFlowGroupDocumentTypes _ExtendedWorkFlowGroupDocumentTypes = new ExtendedWorkFlowGroupDocumentTypes();

        #endregion

        #region Properties

        /// <summary>
        /// Unique id for the datatype
        /// </summary>
        public override Guid Id { get { return new Guid("44FB9079-E28B-4F68-B9EF-0EFAB694A4E3"); } }

        /// <summary>
        /// Name of the datatype
        /// </summary>
        public override string DataTypeName { get { return "ExtendedWorkFlow DocumentTypes"; } }

        #endregion

        #region Constructor

        public ExtendedWorkFlowGroupDocumentTypesDataType()
            : base()
        {
            //set rendercontrol
            base.RenderControl = this._ExtendedWorkFlowGroupDocumentTypes;

            //init event            
            this._ExtendedWorkFlowGroupDocumentTypes.Init += new EventHandler(ExtendedWorkFlowGroupDocumentTypes_Initalised);

            //save event
            base.DataEditorControl.OnSave += new AbstractDataEditorControl.SaveEventHandler(ContentTreeview_Saving);
        }

        #endregion

        #region Control Initalisation

        void ExtendedWorkFlowGroupDocumentTypes_Initalised(object sender, EventArgs e)
        {
            if (base.Data.Value != null)
                this._ExtendedWorkFlowGroupDocumentTypes.Selected = base.Data.Value.ToString();
        }

        #endregion

        #region Saving

        void ContentTreeview_Saving(EventArgs e)
        {
            base.Data.Value = this._ExtendedWorkFlowGroupDocumentTypes.Selected;
        }

        #endregion

    }

}
